package com.qf.feign;

import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.Map;
import java.util.Set;

/**
 * @author lenovo
 * @version V1.0
 * @Date 2021/11/22 21:50
 */
@FeignClient(value = "sms-platform-cache")
public interface CacheService {

    @RequestMapping(value = "/cache/hmget/{key}", method = RequestMethod.GET)
    public Map hMGet(@PathVariable("key") String key);

    @RequestMapping(value = "/cache/get/{key}", method = RequestMethod.GET)
    public String get(@PathVariable("key") String key);

    @RequestMapping(value = "/cache/incr", method = RequestMethod.GET)
    public Long incr(@RequestParam("key") String key, @RequestParam("delta") long delta);

    @RequestMapping(value = "/cache/hincr", method = RequestMethod.GET)
    public Long hincr(@RequestParam("key") String key, @RequestParam("field") String field,@RequestParam("delta") long delta);

    @RequestMapping(value = "/cache/save2cache", method = RequestMethod.POST)
    public boolean set(
            @RequestParam("key") String key,
            @RequestParam("value") String value,
            @RequestParam("expireSecond") Long expireSecond);


    @RequestMapping(value = "/cache/interSet",method = RequestMethod.GET)
    public Set<String> interSet(@RequestParam(value = "key") Set<String> key);
}
